package com.ayu.gulimall.product.controller;


import com.ayu.gulimall.product.service.SkuInfoService;
import com.ayu.gulimall.product.vo.SkuDetailVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class ItemController {

    @Autowired
    SkuInfoService skuInfoService;

    @RequestMapping("/item/{skuId}.html")
    public String itemDetail(@PathVariable("skuId")Long skuId, Model model){
        SkuDetailVO item = skuInfoService.getSkuDetailVOById(skuId);
        model.addAttribute("item",item);

        return "item";
    }
}
